package com.song.springcloud.controller;

import com.song.springcloud.pojo.User;
import com.song.springcloud.service.UserClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class UserConsumerController {

    @Autowired
    private UserClientService service;

    // 测试hystrix服务熔断时，是否返回备用方法处理的错误信息  id =201722 有，id=1 时候没有
    // http://localhost:83/consumer83/user/get/{id}
    @RequestMapping("/consumer83/user/get/{id}")
    @ResponseBody
    public User get(@PathVariable("id") Long id) {
        System.out.println("进入了83controller层");
        return service.queryById(id);
    }


}
